package com.kric.boot.controller;

import com.kric.boot.entity.UserInfo;
import com.kric.boot.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ClassName UserController
 * @Author: zhaozy
 * @Date: 2018-8-1 17:33
 * @Description:
 */
@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private IUserService userService;

    @GetMapping("/list")
    public List<UserInfo> findAll() {
        return userService.findAll();
    }

    @GetMapping("/query")
    public UserInfo findOne(Long id) {
        return userService.findOne(id);
    }

    @GetMapping("/del")
    public void del(Long id) {
        userService.del(id);
    }

    @PostMapping("/save")
    public void saveOrUpdate(UserInfo userInfo) {
        userService.saveOrUpdate(userInfo);
    }
}
